package main

import (
	"github.com/google/wire"
	"gorm.io/gorm"

	"go_user_manager/internal/adapters/controllers"
	"go_user_manager/pkg/adapters/agin"
	"go_user_manager/pkg/adapters/database"
	"go_user_manager/pkg/adapters/grpc"
	"go_user_manager/pkg/framework"
	v1 "go_user_manager/proto/api/hello/v1"
)

var Provider = wire.NewSet(
	v1.NewUserService,
)

func ProvideGrpcServices(service *v1.UserService) []grpc.Instance {
	return []grpc.Instance{service}
}

func ProvideController(
	healthzController *controllers.HealthzController,
	userController *controllers.UserController,
	authController *controllers.AuthController,
) []agin.Controller {
	return []agin.Controller{
		healthzController,
		userController,
		authController,
	}
}

func ProvideDatabase(cfg framework.Configuration) *gorm.DB {
	return database.NewGorm(cfg)
}
